# l1 = [1,5,3]
# n1 = len(l1)
# a = sum(l1[i]*10**(i) for i in range(n1))
# s = "dadjakk"
# for i in s:
#     print(i)
# len(s)
#
# def lengthOfLongestSubstring(self, s):
#     """
#         :type s: str
#         :rtype: int
#     """
#     results = []
#     for i in range(len(s)):
#         count = 0
#         while s[i] == s[i + 1]:
#             i += 1
#             count += 1
#         results.append(count)
#     return max(results)
# lengthOfLongestSubstring(s)
#
# nums1 = [1,6,3]
# nums2 = [1,2]
#
#
# def findMedianSortedArrays(nums1, nums2):
#     """
#     :type nums1: List[int]
#     :type nums2: List[int]
#     :rtype: float
#     """
#     nums1.extend(nums2)
#     nums1.sort()
#     n = len(nums1)
#     if n % 2 == 0:  ##有偶数个数字
#         return (nums1[(n // 2) - 1] + nums1[n // 2]) / 2
#     else:
#         return nums1[int(n // 2)]
#
#
# nums1 = [1,2]
# nums2 = [3,4]
# findMedianSortedArrays(nums1,nums2)
#
# a = 123
# list1 = []
# for i in str(a):
#     list1.append(i)
# print(list1)
#
#
# def isSameAfterReversals(num):
#     """
#     :type num: int
#     :rtype: bool
#     """
#
#     def resort(x):
#         list = []
#         for i in str(x):
#             list.append(i)
#         new_num = 0
#         for i in range(0, len(list), -1):
#             new_num = new_num + list[i] * (10 ** (len(list) - 1))
#         return new_num
#
#     a = resort(resort(num))
#     print(a)
#     return a == num
#
# b = 526
# isSameAfterReversals(b)

list = [5,2,6]
for i in range(2,-1,-1):
    a = i
    print(i)

class Solution(object):
    def isSameAfterReversals(self, num):
        """
        :type num: int
        :rtype: bool
        """
        if int(str(num)[0]) == 0 or int(str(num)[len(num)]) == 0:
            return False
        else:
            return True

n = 1011001110
len(str(n))


def reverseBits(n):
    num = 0
    long = len(str(n))
    count = 0
    for i in str(n)[::-1]:
        print(i)
        num = num + int(i) * (2 ** (long - count + 1))
        count += 1
    return num
